package com.vancouver.knows.business.tracker;

import java.util.Map;

import com.pangu.task.IResultReceiver;
import com.pangu.task.OperateResult;
import com.vancouver.knows.business.BSharedPrefManager;
import com.vancouver.knows.business.BusinessModule;

public class UserGetNoticationSettingTracker extends ABInvokeTracker {

	public UserGetNoticationSettingTracker(BusinessModule module, IResultReceiver resultReceiver) {
		super(module, resultReceiver);
	}

	@Override
	public String TAG() {
		return UserGetNoticationSettingTracker.class.getSimpleName();
	}

	@Override
	public void handleResult(OperateResult result) {
		Map map = (Map) result.getResultData();
		if (map == null)
			return;

		BSharedPrefManager sharedPrefManager = new BSharedPrefManager(imContext);
		String postReminder = (String) map.get("post_reminder");
		String commentReminder = (String) map.get("comment_reminder");
		String businessReminder = (String) map.get("business_reminder");
		sharedPrefManager.saveMyArticleNewComment("Y".equals(postReminder) ? true : false);
		sharedPrefManager.saveMyFollowedBusiness("Y".equals(businessReminder) ? true : false);
		sharedPrefManager.saveHaveAtCommentMessage("Y".equals(commentReminder) ? true : false);

		if (!"Y".equals(postReminder) && !"Y".equals(businessReminder) && !"Y".equals(commentReminder)) {
			sharedPrefManager.saveCloseAllMessage(false);
		} else {
			sharedPrefManager.saveCloseAllMessage(true);
		}
	}
}
